/**
 * 
 */
package com.goldsign.pay.common.core.document.swagger2;

import com.goldsign.pay.common.core.document.ApiDoc;

import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author johnny
 *
 */
public class Swagger2BaseDoc extends ApiDoc{
	protected static String title="springboot swagger api title";
	protected static String description="demo description";
	protected static String version="swagger api 1.0.0";
	protected static String serviceUrl="url";
	
	public Docket createRestApi() {
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo())
				.select()
/**				.apis(RequestHandlerSelectors.basePackage("com.goldsign.pay.provider"))*/
/**				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))*/
				.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
				.paths(PathSelectors.any())
				.build();
	}
	
	private ApiInfo apiInfo() {
		return new ApiInfoBuilder()
				.title(title)
				.description(description)
				.termsOfServiceUrl(serviceUrl)
				.version(version)
				.build();
	}
}
